
<template>
	<view >		
		<scroll-view scroll-y class="page">
			<cu-custom bgColor="bg-gradual-pink" :isBack="true">
				<block slot="backText"></block>
				<block slot="content">意见反馈</block>				
			</cu-custom>
			<!-- list列表 -->
			<view style="padding: 10px 10px 0  10px;">
			
			<view class="cu-list menu">	
				
				<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.2s'}]">
					<view class="content">
						<text class="text-grey">意见主题</text>
					</view>
					<view class="action">	
						<input placeholder="请输入意见主题" name="input" v-model="sugForm.title"></input>
						
					</view>
				</view>
			</view>	
			<view class="cu-list menu">				
				
				<view class="cu-item animation-slide-bottom" :style="[{animationDelay: '0.3s'}]">
					<view class="content">
						<text class="text-grey">意见内容</text>
					</view>
					<view class="action">
						<textarea placeholder="请输入意见内容"  name="input" v-model="sugForm.content"></textarea>						
					</view>
				</view>				
				
			</view>	
			
		</view>
		<view class="padding flex flex-direction">
			<button class="cu-btn bg-green lg"  @click="onSubmit">提交</button>
		</view>
	

		</scroll-view>
	</view>
</template>

<script>
	import api from '@/api/api.js'
	export default {
		data() {
			return {
				toggleStatus: false,
				searchVal: '',
				loading: false,			
				sugForm:{
					title:'',
					accCode:'',
					openid:'',
					content:''
				},			
				sugUrl:'/mp/jwWebJwid/submitSug',
			};			
		},
		onLoad() {
			let accCode=store.state.accCode?store.state.accCode:store.getters.accCode;
			if(accCode){
				this.sugForm.accCode=accCode;
			}
			let openid=store.state.openid?store.state.openid:store.getters.openid;
			if(openid){
				this.sugForm.openid=openid;
			}
		},
		created(){
		   
		},
		methods: {
				
			onSubmit(){
				
				if(!this.sugForm.title){
				    this.$tip.toast('请填写意见主题');
				    return;
				}
				if(!this.sugForm.content){
					this.$tip.toast('请填写意见内容');
					return;
				}
												
				this.$http.post(this.sugUrl,this.sugForm).then(res=>{				
					if (res.data.success) {
						this.$tip.success('提交成功!')
						this.$Router.replaceAll({name:'home'})
					}else{
						this.$tip.error(res.message)
					}
				}).catch(err => {
					console.log(err);
				});
			}
		}
	}
</script>

<style>
	.page {
		height: 100Vh;
		width: 100vw;
	}

	.page.show {
		overflow: hidden;
	}
	
	.uni-group {
		display: flex;
		align-items: center;
	}
</style>
